// https://blog.csdn.net/Serenity_Qin/article/details/135893767?spm=1001.2101.3001.6650.3&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EYuanLiJiHua%7EPosition-3-135893767-blog-133711278.235%5Ev43%5Epc_blog_bottom_relevance_base2&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EYuanLiJiHua%7EPosition-3-135893767-blog-133711278.235%5Ev43%5Epc_blog_bottom_relevance_base2&utm_relevant_index=4
// https://blog.csdn.net/ACCPluzhiqi/article/details/131744102
// https://blog.csdn.net/ACCPluzhiqi/article/details/131744102
// 校驗規格參考鏈接

// 手机号码验证
const validatePhone = (rule, value, callback) => {
	const patter = new RegExp(
		"^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$"
	);
	if (!patter.test(value)) {
		return callback(new Error("请输入正确格式的手机号！"));
	} else {
		callback(); // 必须有此项回调，否则验证会一直不通过
	}
};
// 邮箱的正则
const validateEmail = (rule, value, callback) => {
	const mailbox = new RegExp(
		"^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(.[a-zA-Z0-9-]+)*.[a-zA-Z0-9]{2,6}$"
	);
	if (!mailbox.test(value)) {
		return callback(new Error("请输入正确格式的邮箱！"));
	} else {
		callback();
	}
};
// 身份证号
const validateIdCardNo = (rule, value, callback) => {
	const mailbox = new RegExp(
		"^[1-9]d{5}(18|19|([23]d))d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)d{3}[0-9Xx]$)|(^[1-9]d{5}d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)d{2}[0-9Xx]$"
	);
	if (!mailbox.test(value)) {
		return callback(new Error("请输入正确格式的身份证号！"));
	} else {
		callback();
	}
};
export default {
	common: {
		// ---------------------公共验证方法

		phone: [{
				// 手机号
				required: true,
				message: "手机号不能为空",
			},
			{
				validator: validatePhone,
				trigger: "blur",
			},
		],
		email: [{
				// 邮箱
				required: true,
				message: "邮箱",
			},
			{
				validator: validateEmail,
				trigger: "blur",
			},
		],
		idCardNo: [{
				// 身份证号码
				required: true,
				message: "身份证号码不能为空",
			},
			{
				validator: validateIdCardNo,
				trigger: "blur",
			},
		],
	},
	handle: {
		// ---------------------处理表单的验证方法
		// 收件电话
		AddresseeTel: [{
				// 手机号
				required: true,
				errorMessage: "请输入手机号",
			},
			{
				pattern: /^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$/,
				errorMessage: '请输入正确格式的手机号！'
			}
		],
		// 联系电话
		TelNumber: [{
				// 手机号
				required: true,
				errorMessage: "请输入手机号",
			},
			{
				pattern: /^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$/,
				errorMessage: '请输入正确格式的手机号！'
			}
		],
		// 电环
		Tel_Code: [{
				// 手机号
				required: true,
				errorMessage: "请输入手机号",
			},
			{
				pattern: /^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$/,
				errorMessage: '请输入正确格式的手机号！'
			}
		],
		SWOTitle: [{
			// 工单标题
			required: true,
			errorMessage: "请输入工单标题",
		}, ],
		SWOType: [{
			// 工单标题
			required: true,
			errorMessage: "请输入工单类型",
		}, ],
		SalesmanName: [{
			// 执行人
			required: true,
			errorMessage: "请输入执行人",
		}, ],
		ReceiveAddress: [{
			//用户名
			required: true,
			errorMessage: "请输入收货地址",
		}, ],
		// 客户名称
		CustomerName: [{
			//用户名
			required: true,
			errorMessage: "请选择客户",
		}, ],
		// 客户名称
		cCusName: [{
			//用户名
			required: true,
			errorMessage: "请输入客户名称",
		}, ],
		// 省份
		cProvince: [{
			required: true,
			errorMessage: "请选择省份",
		}, ],
		// 市
		cCity: [{
			required: true,
			errorMessage: "请选择市",
		}, ],
		// 区
		cCounty: [{
			//用户名
			required: true,
			errorMessage: "请选择区",
		}, ],
		userName: [{
			//密码
			required: true,
			errorMessage: "请输入用户名",
		}, ],
		password: [{
			//密码
			required: true,
			errorMessage: "请输入密码",
		}, ],
		Addressee: [{
			//收件人
			required: true,
			errorMessage: "请选择收件人",
		}, ],
		Address: [{
			//收件地址
			required: true,
			errorMessage: "请输入收件地址",
		}, ],
		Remark: [{
			//备注
			required: true,
			errorMessage: "请输入备注",
		}, ],
		DailyRecordDate: [{
			//日期
			required: true,
			errorMessage: "请选择日期",
		}, ],
		DailyRecordTitle: [{
			//标题
			required: true,
			errorMessage: "请输入标题",
		}, ],
		DailyRecord: [{
			//交流内容
			required: true,
			errorMessage: "请输入交流内容",
		}, ],
		SharerName: [{
			//交流内容
			required: true,
			errorMessage: "请选择抄送",
		}, ],
		Name: [{
			//交流内容
			required: true,
			errorMessage: "请输入姓名",
		}, ],
		RoleName: [{
			//交流内容
			required: true,
			errorMessage: "请选择角色名称",
		}, ],

		// 反馈信息
		FeedbackInfo: [{
			//交流内容
			required: true,
			errorMessage: "请输入反馈信息",
		}, ],
		// 关联单号
		RelationNo: [{
			//交流内容
			required: true,
			errorMessage: "请选择关联单号",
		}, ],
		// 申请日期
		ApplicationDate: [{
			required: true,
			errorMessage: "请选择申请日期",
		}, ],
		// 申请日期
		ApplicationDate: [{
			required: true,
			errorMessage: "请选择申请日期",
		}, ],
		// 公司名称
		CompanyName: [{
			required: true,
			errorMessage: "请选择公司",
		}, ],
		// 年月
		iYearMonth: [{
			required: true,
			errorMessage: "请选择年月",
		}, ],
		// 部门名称
		DeptName: [{
			required: true,
			errorMessage: "请选择部门",
		}, ],
		// 报销人姓名
		ApplicationPerson: [{
			required: true,
			errorMessage: "请输入报销人姓名",
		}, ],
		// 业务性质
		// ExpenseType: [{
		// 	required: true,
		// 	errorMessage: "请选择业务性质",
		// }, ],
		ExpenseTypeName: [{
			required: true,
			errorMessage: "请选择业务性质",
		}, ],
		// 票据类型
		BillType: [{
			required: true,
			errorMessage: "请选择票据类型",
		}, ],
		// 发票分类
		InvoiceClassification: [{
			required: true,
			errorMessage: "请选择发票分类",
		}, ],
		// 出发日期
		DepartureDate: [{
			required: true,
			errorMessage: "请选择出发日期",
		}, ],
		// 到达日期
		ArrivalDate: [{
			required: true,
			errorMessage: "请选择到达日期",
		}, ],
		// 出发城市
		DepartureCityName: [{
			required: true,
			errorMessage: "请选择出发城市",
		}, ],
		// 到达城市
		ArrivalCityIdName: [{
			required: true,
			errorMessage: "请选择到达城市",
		}, ],
		// 开始日期上下午
		DepartureAMPM: [{
			required: true,
			errorMessage: "请选择上下午",
		}, ],
		// 结束日期上下午
		ArrivalAMPM: [{
			required: true,
			errorMessage: "请选择上下午",
		}, ],

		// 内部企业
		IsInternal: [{
			required: true,
			errorMessage: "请选择内部企业",
		}, ],

		// 所属公司
		DeptCode: [{
			required: true,
			errorMessage: "请选择所属公司",
		}, ],
		// 新密码
		newPwd: [{
			required: true,
			errorMessage: "请输入新密码",
		}, ],
		// 再次确认新密码
		newPwd1: [{
			required: true,
			errorMessage: "请再次确认新密码",
		}, ],
		// 旧密码
		oldPwd: [{
			required: true,
			errorMessage: "请输入原密码",
		}, ],

		// 返回日期
		ReturnDate: [{
			required: true,
			errorMessage: "请选择返回日期",
		}, ],
		// 票据日期
		BillDate: [{
			required: true,
			errorMessage: "请选择票据日期",
		}, ],
		// 客户拜访说明
		Infor: [{
			required: true,
			errorMessage: "请输入客户拜访说明",
		}, ],
		// 交通方式
		TransportationMode: [{
			required: true,
			errorMessage: "请选择交通方式",
		}, ],
		// 行程名称
		TripName: [{
			required: true,
			errorMessage: "请输入行程名称",
		}, ],
		// 报销单名称
		ReimbursementName: [{
			required: true,
			errorMessage: "请输入报销单名称",
		}, ],
		// 报销总金额
		ReimburseAmount: [{
			required: true,
			errorMessage: "请输入报销总金额",
		}, ],
		// 票面总金额
		FaceAmount: [{
			required: true,
			errorMessage: "请输入票面总金额",
		}, ],
	},
};